<?php

$id = $_GET['id'];

$oldData =  file_get_contents('./db/data.txt');

$oldData = json_decode($oldData,true);
// array_splice($oldData,$id,1);

unset($oldData[$id]);

file_put_contents('./db/data.txt',json_encode($oldData));

header("Location:./index.php");